<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<jsp:include page="../admin.jsp"></jsp:include>
<html>
<head>
<title>【${o.name}】编辑编码</title>
<jsp:include page="../../../inc/js.jsp"></jsp:include>
<jsp:include page="../../../inc/css.jsp"></jsp:include>
<script type="text/javascript">
	$(function() {
		$("#update").button().click(function() {
			var id=$("#id").val();
			if(id=="")f.action="insertCode.do";
			else f.action="updateCode.do";
			var options = {
	    		dataType:'json',
   			 	success: function(data) {
					if(data.success){
						clearSelect();
						alert('操作成功！');
					}
					else
						alert('操作失败！'+data.err);
   			 }};
			$("#f").ajaxSubmit(options);
			return false;
		});
		$("#add").button().click(function() {
			$("#f").clearForm();
			return false;
		});
		$("#back").button().click(function() {
			//location.href="codeList.do";
			window.history.back();
			return false;
		});
	});
</script>
</head>
<body>
<form action="#" id="f" method="post"><input type="hidden"
	id="id" name="id" value="${o.id}">
<table>
	<tr>
		<td>编码：</td>
		<td><input type="text" id="code" name="code" value="${o.code}"></td>
	</tr>
	<tr>
		<td>父节点编码：</td>
		<td><input type="text" id="pCode" name="pCode" value="${o.pCode}"></td>
	</tr>
	<tr>
		<td>名称：</td>
		<td><input type="text" id="name" name="name" value="${o.name}"></td>
	</tr>
	<tr>
		<td>分类编码：</td>
		<td><input type="text" id="type" name="type" value="${o.type}"
			class=short></td>
	</tr>
	<tr>
		<td>启用：</td>
		<td><select id="enabled" name="enabled">
			<option value="1" <c:if test="${o.enabled=='1'}">selected</c:if>>是</option>
			<option value="0" <c:if test="${o.enabled=='0'}">selected</c:if>>否</option>
		</select></td>
	</tr>
	<tr>
		<td colspan="2">
		<center>
		<button id="update">保存</button>
		<button id="add">新建</button>
		<button id="back">返回</button>
		</center>
		</td>
	</tr>
</table>
</form>
</body>
</html>